<?php
	$languagess[1] = " EN";
	$languagess[2] = "";
	$languagess[3] = " DE";
	$languagess[4] = " FR";
	$languagess[5] = " ES";
	
	for($i = 14; $i < 31; $i++)
	{
		foreach($languagess as $key => $languag)
		{
			echo $key;
			$in["language_id"] = $key;
			$in["name"] = "Product $i".$languag;
			$in["description"] = file_get_contents('http://loripsum.net/api/3/long/decorate/link/ul/');
			$in["url"] = getrandomurl(strtolower(rand(16, 20))).strtolower($languag);
			$in["product_id"] = $i;
			$connection->insert("products_details", $in);
		}
	}
	
	

	function getrandomurl($length) {
	
	       global $template;
	       settype($template, "string");
	
	       $template = "abcdef-ghijklmnopqrstu-vwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-";
	
	       settype($length, "integer");
	       settype($rndstring, "string");
	       settype($a, "integer");
	       settype($b, "integer");
	
	       for ($a = 0; $a <= $length; $a++) {
	               $b = rand(0, strlen($template) - 1);
	               $rndstring .= $template[$b];
	       }
	
	       return $rndstring; 
	}

	
?>